package com.mdz.sbgl.util;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.mdz.sbgl.Entity.Sbwhb;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class PageUtil {
	public static String getpagestr(@RequestParam(value = "pageNumber",defaultValue = "1") int pageNumber, @RequestParam(value = "pageSize",defaultValue = "10") int pageSize, List<?> pagelist,List<?> pagerows){
		System.out.println("工具类中的pageNumber值为："+pageNumber);
		System.out.println("工具类中的pageSize值为："+pageSize);
		PageHelper.startPage(pageNumber, pageSize);  ///.like("sbbh",cxtj)
		PageInfo page=new PageInfo(pagelist);
		pagerows = page.getList();
		int total = (int)page.getTotal();
		JSONObject result = new JSONObject();
		result.put("rows",pagerows);
		result.put("total",total);
		return result.toJSONString();
	}

}
